package cn.com.huzo.repository.trade.impl;

import cn.com.huzo.model.entities.trade.InspectionJournalLinesMaterialEntity;
import cn.com.huzo.model.entities.trade.InspectionJournalLinesNoOfStyleEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import cn.com.huzo.repository.trade.InspectionJournalLinesMaterialRepository;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;

/**
 * 化检日记账资材明细数据访问对象。
 *
 * @author 范学春
 */
@Repository("InspectionJournalLinesMaterialRepository")
public class InspectionJournalLinesMaterialRepositoryImpl extends GenericRepositoryImpl<InspectionJournalLinesMaterialEntity, String>
        implements InspectionJournalLinesMaterialRepository {

    private final String namespace = "cn.com.huzo.repository.trade.InspectionJournalLinesMaterialRepository";

    /**
     * 构造函数,设置the entity to DeliveryOrderHeaderRepositoryImpl.class.
     */
    public InspectionJournalLinesMaterialRepositoryImpl() {
        super(InspectionJournalLinesMaterialEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<InspectionJournalLinesMaterialEntity> fetchByHeaderKey(Long headerKey) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderKey"), headerKey);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<InspectionJournalLinesMaterialEntity> fetchByNoOfStyle(Map<String, Object> matchValue) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByNoOfStyle"), matchValue);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<InspectionJournalLinesMaterialEntity> fetchMaterialByNoOfStyle(Map<String, Object> matchValue) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchMaterialByNoOfStyle"), matchValue);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insert(Map<String, Object> matchValue) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insert"), matchValue);

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insertSelectedData(List<InspectionJournalLinesMaterialEntity> dataList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insertSelectedData"), dataList);

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer update(List<InspectionJournalLinesMaterialEntity> dataList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdateLines"), dataList);
    }

    /**
     * {@inheritDoc}
     * <p>
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }

    /**
     * {@inheritDoc}
     * <p>
     */
    @Override
    public Integer batchDeleteLines(List<InspectionJournalLinesMaterialEntity> instance) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchDeleteLines"), instance);
    }
}
